package cn.wolfcode.wolf2w.util;

import lombok.Getter;

@Getter
public enum RedisKeys {

    STRATEGY_THUMBUP_VO("strategy_thumbup_vo", -1l),

    //收藏数
    STRATEGY_FAVOR_VO("strategy_favor_vo", -1l),
    //攻略回复数
    STRATEGY_REPLY_VO("strategy_reply_vo", -1l),

    //攻略统计vo的key实例对象
    STRATEGY_STATIS_VO("strategy_statis_vo", -1l),

    //累计访问
    person_all_visit("person_all_visit", -1l),
    //今日访问
    person_today_visit("person_today_visit", -1l),


    //短信验证码
    VERIFY_CODE("verirfy_code", 60 * 5L),

    //登录token
    LOGIN_TOKEN("user_login_token", 60 * 30L);

    private String prefix;
    private Long time;

    private RedisKeys(String prefix, Long time) {
        this.prefix = prefix;
        this.time = time;
    }

    public String join(String... keys) {
        StringBuilder sb = new StringBuilder();

        sb.append(prefix);
        for (String key : keys) {
            sb.append(":").append(key);
        }
        return sb.toString();
    }
}
